﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Xejen.Commands.Models
{
    /// <summary>
    /// 表示作业的公共参数
    /// </summary>
    public class JobMetadata
    {
        /// <summary>
        /// 电芯唯一 ID，用于整合多次传输过来的数据
        /// </summary>
        public string JobId { get; }
        /// <summary>
        /// 设备状态，如电芯出站，这样“平台”就知道该给客户 MES 接口发起“电芯出站”的接口请求了
        /// </summary>
        public string JobType { get; }
        /// <summary>
        /// PLC 站点 ID，用于将多电芯下的各个设备的原始数据合并
        /// </summary>
        public string JobStation { get; }

        /// <inheritdoc cref="JobMetadata"/>
        public JobMetadata(string jobId, string jobType, string jobStation)
        {
            JobId = jobId;
            JobType = jobType;
            JobStation = jobStation;
        }

        /// <summary>
        /// 将元数据转为字典
        /// </summary>
        /// <returns></returns>
        public Dictionary<string, object> ToDictionary()
        {
            var data = new Dictionary<string, object>
                {
                    { "JobId", JobId },
                    { "JobType", JobType },
                    { "JobStation", JobStation }
                };

            return data;
        }
    }

}
